package live.common;

import java.net.URL;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.xml.DOMConfigurator;
import org.apache.struts.action.ActionServlet;

public class Log4jXmlConfig extends ActionServlet {
	private static Log4jXmlConfig instance;

	public static synchronized Log4jXmlConfig getInstance() {
		if (instance==null) {
			instance = new Log4jXmlConfig();
		}
		return instance;
	}
	
	private Log4jXmlConfig() {
		// TODO Auto-generated constructor stub
		final URL url = Log4jXmlConfig.class.getResource("/log4j.xml");
		DOMConfigurator.configure(url);
	}
	
	public Logger returnLogger(Class T){
		return LogManager.getLogger(T);
	}
}
